<?php

namespace App\Listeners;

use App\Func\System\OperateLogFunc;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\Events\JobProcessed;
use Illuminate\Queue\InteractsWithQueue;

class QueueJobProcessedListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  \Illuminate\Queue\Events\JobProcessed  $event
     * @return void
     */
    public function handle(JobProcessed $event)
    {
        // 获取队列任务的数据
        $payload = $event->job->payload();
        echo $payload['displayName'];
        // 添加操作记录
        OperateLogFunc::addOperate(
            'test',1,$payload['displayName']
        );
    }
}
